import {
  HYEventStore
} from "hy-event-store"
import {
  getRecomendList
} from "../services/music"
// 使用 store
const rankingMap = {
  newRanking: 3779629,
  originRanking: 2884035,
  upRanking: 19723756
}
const rankingStore = new HYEventStore({
  state: {
    newRanking: {},
    originRanking: {},
    upRanking: {}
  },
  actions: {
    fetchRankingDataAction(ctx) {
      for (const key in rankingMap) {
        const id = rankingMap[key]
        getRecomendList(id).then(res => {
          // console.log(res);
          ctx[key]=res.playlist
        })
      }
    }
  }
})
export default rankingStore